<template>
	<view class="s-m-b">
		<uni-popup ref="shareMenu" type="bottom">
			<view class="s-b">
				<view class="s-i" @click="$refs.shareMenu.close()">
					<image src="/static/wx.png" ></image>
					<view class="">微信好友</view>
					<!-- #ifdef MP -->
					<button class="btn" open-type="share"></button>
					<!-- #endif -->
				</view>
				<!-- #ifndef MP -->
				<view class="s-i" @click="handleShare(2)">
					<image src="/static/public/p_pyq.png" ></image>
					<view class="">朋友圈</view>
				</view>
				<!-- #endif -->
				<view class="s-i" v-if="isMore" @click="handleShare(3)">
					<image src="/static/sharepic.png" ></image>
					<view class="">海报分享</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				shopInfo: {}
			}
		},
		props: {
			isMore:{
				type: Boolean,
				default: true
			}
		},
		methods: {
			open(e) {
				this.shopInfo = e
				this.$refs.shareMenu.open()
			},
			async handleShare(e) {
				uni.showLoading({
					title: '请稍候'
				})
				this.$refs.shareMenu.close()
				if (e == 3) {
					let res = await this.$axios('Detail/create_goods_poster', 'POST', 'pintuan', {
						goodsid:this.shopInfo.goodsid,
						pintuan_list_id: this.shopInfo.id
					})
					if (res.data.code == 200) {
						uni.previewImage({
							urls: [res.data.data.url]
						})
					}

				}
				uni.hideLoading()
			}
		}
	}
</script>

<style lang="scss" scoped>
	.s-m-b {
		position: relative;
		z-index: 1000;
	}

	.s-b {
		padding: 30rpx 0;
		background: #fff;
		display: flex;
		justify-content: space-evenly;
	}

	.s-i {
		text-align: center;
		position: relative;

		image {
			height: 100rpx;
			width: 100rpx;
		}

		.btn {
			position: absolute;
			border: none;
			left: 0;
			top: 0;
			width: 100%;
			height: 100%;
			opacity: 0;
			z-index: 1;
		}
	}

	.h-b-b {
		padding: 0;

		image {
			width: 690rpx;
		}
	}
</style>